home *** CD-ROM | disk | FTP | other *** search
/ Power Programmierung / Power-Programmierung (Tewi)(1994).iso / magazine / c_news / 05 / cnews005.nws
Text File  |  1988-03-07  |  47KB  |  997 lines

  1.      Volume 1, Number  5                                 06 March 1988
  2.      +---------------------------------------------------------------+
  3.      |                                                               |
  4.      |                       -  C   News  -                          |
  5.      |                                                               |
  6.      |                        International                          |
  7.      |                C Programming & Compiler Review                |
  8.      |                         Newsletter                            |
  9.      |                                                               |
  10.      +---------------------------------------------------------------+
  11.      US Office:
  12.      Editor at large                                       Barry Lynch
  13.      Assistant Editor                                      Ami Dworkin
  14.      Technical Editor                                Marshall Presnell
  15.  
  16.      Australian Office:     
  17.      Editor                                               David Nugent
  18.  
  19.      C News  is  published  bi-weekly by  the  C BBS as its official
  20.      newsletter.  You are encouraged to submit articles for publication
  21.      in C News.  Articles should be related to C programming and can be
  22.      Tutorials, reviews or articles of interest to the C programming
  23.      community.  All Operating systems are fairly represented and this
  24.      newsletter shows no favoritism to any one in particular.  Instruct-
  25.      ions on how to submit articles for publication is included on the
  26.      last page. 
  27.           
  28.      C News is the property of the C BBS and is Copyright 1988 by the
  29.      the C BBS.  All rights are reserved and distribution is limited to
  30.      electronic distribution and personal printed copies.  C News cannot
  31.      be resold at any profit, by any organization.  All material enclosed
  32.      within the newsletter is the opinions of the writers and not the
  33.      C BBS or it's Sysop. 
  34.      
  35.      C News 1-05                                          06 Mar 1988
  36.  
  37.      =================================================================
  38.                              TABLE OF CONTENTS
  39.      =================================================================
  40.      
  41.  
  42.      1. EDITORIAL 
  43.              The Heap: messages from the editor....................  1
  44.  
  45.      2. BOOK REVIEWS
  46.         TurboC Memory Resident Utilities  .........................  2
  47.             Reviewed by Magnus Cameron
  48.           
  49.      3. FEATURE ARTICLE
  50.         The Integrated Environment  ...............................  3
  51.             by David Nugent
  52.  
  53.      4. /Usr/Bin
  54.            by Marshall Presnell   .................................  9
  55.  
  56.      5. NOTES
  57.         Article Submission Standards  ............................. 16
  58.         Address's   ............................................... 17
  59.         USER Response Form  ....................................... 18
  60.     
  61.      6. INDEX   ................................................... 19
  62.  
  63.      7. DISTRIBUTION POINTS   ..................................... 21
  64.  
  65.      C News 1-05                 Page 1                   03 Mar 1988
  66.  
  67.      =================================================================
  68.                                  EDITORIAL
  69.      =================================================================
  70.  
  71.      The HEAP: Messages from the Editor.
  72.  
  73.  
  74.           One of the areas of Computer Science that currently fascinates
  75.      me is: Computer-Aided-Software-Engineering (CASE).  Lately, I have 
  76.      been reading a book on diagramming techniques for analysts and
  77.      programmers.  The author stresses that effective automated diagramming
  78.      techinques can be used to design and dicument a system.  He goes on
  79.      to state that a "code-generator" can be used to create code from the
  80.      the system flows(diagrams) that are created by the systems analyst.
  81.  
  82.            Well, needless to say this was of great interest to me, being
  83.      a systems analyst by profession.  The idea of using a computer to
  84.      create the diagrams and be able to change them at will and have the 
  85.      documentation change also was fascinating.   Here on the C BBS we have
  86.      a group project called PC-SCCS.  Which is a public domain Source
  87.      Control System based on capabilities on the SCCS found on on UNIX 
  88.      machines.  After, reading this book I decided to change the scope 
  89.      of PC-SCCS to encompass the CASE ideas.  Therefore, the name of the 
  90.      project is now PC-CASE.  This project by any definition is complicated
  91.      and extremely technical.  I make no guarantees that it will ever be
  92.      completed but if anyone is interested in exchanging ideas on this 
  93.      subject, you are encouraged to send your thoughts here to the C BBS.
  94.      In the meantime I plan to write a simple tutorial on CASE for C News.
  95.      Hopefully, over time something concrete will come of this project.
  96.  
  97.           On another topic, I have attempted to put togther a list of
  98.      regular distribution points of C News.  If I have forgotten any 
  99.      net/nodes that requested it previously, I apologize.  If you are
  100.      interested in carrying C News for your readers < if you are a Sysop>
  101.      or you would like your favorite BBS to carry C News, let your sysop
  102.      know where he can get in touch with me.  C News is for C programmers
  103.      worldwide and it is with your support that it continues.
  104.  
  105.      
  106.       B C'ng U
  107.  
  108.       Barry Lynch
  109.  
  110.      C News 1-05                 Page 2                   06 Mar 1988
  111.      
  112.      ================================================================
  113.                              BOOK REVIEWS                     
  114.      ================================================================
  115.  
  116.      ________________________________________________________________
  117.  
  118. Title:  TurboC - Memory-Resident Utilities, Screen I/O and 
  119.         programming techniques. 
  120.  
  121. Author: Al Stevens. 
  122. Publisher: MIS Press, 1107 N.W. 14th Avenue, Portland, Oregon 97209. 
  123. ISBN 0-943518-35-0 
  124.  
  125. This  is  a  very  good  book  if  you  want  to  develop a windows
  126. user environment for  your programs.   The book  starts off  with a few
  127. bland chapters which are not really  worth reading.  Then the chapters 
  128. on the windows and data entry screens are next. 
  129.  
  130. I  bought  this  book  mainly  for  the  window  handling routines. 
  131. The chapters  on   windows  are   excellent.   Unfortunately   the 
  132. code is non-portable  even  across  some  MS-DOS  compilers.   A  lot
  133. of code is presented but is not completely documented.   It is up to
  134. the reader to decipher and  work out  what is  going on.   There is  no
  135. discussion for example on linked lists which you would expect in a book
  136. that uses  them extensively.  Previous knowledge on a  lot of subjects
  137. is assumed.   But if you are  a medium to  advanced C programmer  then
  138. you may,  as I did, find this  book very  useful for  developing your 
  139. own windows  library. 
  140.  
  141. This book is not for the beginner.  I have modified much of the code 
  142. in an attempt to make it more portable, and you may be faced with the 
  143. same peril if you don't only run MSDOS. 
  144.  
  145. An excellent chapter on TSR's  (MSDOS specific) is then presented 
  146. which is followed by a chapter  on how to make your  C programs pop up
  147. at  the touch of  a HOT  key.  (See  CNEWS004 for  an article 
  148. referring to this book).  These chapters are really  very informative,
  149. but you are  warned now about portability. 
  150.  
  151. Generally a great  book if you  need some help  in writing some 
  152. windows libraries and if you are too lazy like me to write Assembler
  153. TSR's. 
  154.  
  155. Magnus Cameron. (Melbourne, Australia) 
  156.  
  157.  
  158.  
  159.  
  160.      C News 1-05                 Page 3                   06 Mar 1988
  161.      
  162. ================================================================
  163. Title: Integrated Environments. 
  164. ================================================================
  165.  
  166. The Integrated Environment
  167. --------------------------
  168.  
  169. David Nugent,
  170. Sysop: Alpha Centauri BBS 3:632/348
  171. Melbourne, Australia
  172.  
  173.  
  174. C  is a language steeped in 'tradition' (or more  tradition  than 
  175. one  would  expect  in  its colorful but  short  life).   It  was 
  176. designed as a 'symbolic assembler' to provide the programmer with 
  177. a  means  of making code portable between operating  systems  and 
  178. types  of  processors.  Until recently, it has  not  enjoyed  the 
  179. public  exposure or popularity as the more  'hobbyist'  languages 
  180. such  as  BASIC or later Pascal.  During its early  evolution,  C 
  181. became the tool of academics and systems programmers, only to  be 
  182. looked at in awe by others.
  183.  
  184. Perhaps  this history has made the veteran C programmer quick  to 
  185. "poo-poo" the idea of the "integrated environment", first seen in 
  186. programming languages when Turbo Pascal was released.  That  fine 
  187. product  put  Pascal  on  the map,  bringing  it  back  from  the 
  188. obscurity  toward  which  it  was  surely  headed  after  Digital 
  189. Research dropped its commitment to MT+.  So now we see the latest 
  190. offerings   in  this  technology  in  Bourland's  Turbo   C   and 
  191. Microsoft's Quick C.  Few veterans approved of the idea. 
  192.  
  193. The  "integrated  environment" as such is not such  a  new  idea.  
  194. Unix  had  one - a C interpreter (an environment not  unlike  the 
  195. BASIC interactive editor concept).  Many of these are still  used 
  196. for  small  and  large  program  development;  some  being  quite 
  197. sophisticated  in  their  scope - including a  full  armament  of 
  198. debugging  tools.  But no-one can deny that with the  release  of 
  199. Turbo  and Quick C (and their relative low cost), the face  of  C 
  200. programming changed overnight.  The language's power became quite 
  201. accessible to a much larger audience.
  202.  
  203. This brings me to my own personal experiences.  I began  learning 
  204. C  under MS-DOS in the days of Lattice 1.00; a terribly slow  and 
  205. inefficient  compiler by today's standards, with a  library  that 
  206. included only basic I/O functions and not at all Unix compatible.  
  207. It  was a real "bare bones" compiler, and I owe a lot to  it  and 
  208. MSC 2.0 (much the same, but with a better optimizer) for my early 
  209. experiences in dealing with low-level routines and MS-DOS.  Spent 
  210. many  hours in DEBUG trace discovering the rudiments of  how  the 
  211. chip/OS  worked.  I had no comfort in fancy  symbolic  debuggers, 
  212. nor  any convenient workbench other than a few  self  'inflicted' 
  213. batch  files  used to carry out  the  edit/compile/link  process.  
  214. C News 1-05                 Page 4                   06 Mar 1988
  215.      
  216. ================================================================
  217. Title: Integrated Environments. 
  218. ================================================================
  219.  
  220. Eventually  I  discovered  MAKE,  and  my  program  and   library 
  221. development changed overnight.
  222.  
  223. Eventually, I upgraded to MSC 4.0, but in between discovered  SCO 
  224. Xenix and its MSC 3.0 compatible compiler.  Again, no  integrated 
  225. environment  and  'make' was the real life and  time  saver.   My 
  226. introduction  to  integrated environments began when  I  acquired 
  227. Turbo C 1.0.
  228.  
  229. From  that experience, I couldn't say that I would use it  often.  
  230. Took  too  long  to  load,  and the  editor  is  not  crash  hot, 
  231. especially when others around offer MUCH better CMODE style.   It 
  232. did have the familiar "wordstar" type commands, though, so  using 
  233. it was no drama.  But by that time, I had learned how to use (and 
  234. abuse)  every editor under the sun anyway, and a change  for  the 
  235. better would indeed have been welcome.
  236.  
  237. I  found  it a good way to cut, develop and debug single  or  few 
  238. module  applications.  Particularly liked the ability to  produce 
  239. quick and dirty .COM files.  However, it was not really  suitable 
  240. for my mainstream development, which was at that time mainly  the 
  241. code  of  library modules.  I needed to support  making  of  MASM 
  242. files  as  well,  make  - being  completely  independent  of  any 
  243. language  - provided a far more convenient means of  constructing 
  244. full  libraries.  But then again, the integrated  environment  is 
  245. INTERACTIVE, and is really meant for just that, and that's  where 
  246. I  found its worth.  Certainly the Turbo C command line  compiler 
  247. was  (is)  impressive  and  was used  far  more  often  than  the 
  248. environment.
  249.  
  250. Enter  Quick C.  I have only had this product a few days  due  to 
  251. shipping  problems  out here in Australia, so I can  only  convey 
  252. "first  impressions".   Frankly, I am  impressed.   Looks  almost 
  253. entirely like the Quick Basic 4.0 environment with C  extensions. 
  254. (should I admit to using QB4??).  Although the debugger is useful 
  255. (used it tonight to track down one of those errors that the  more 
  256. you  looked  at  the code, the harder it is to  find)  and  quite 
  257. powerful, it lacks many of the features of Turbo C's  environment 
  258. that  I  found most useful, but makes up for it  in  other  ways.  
  259. When  are  these two companies going to get together and  make  a 
  260. really  DYNAMITE  product!  <grin>  Each  product  has  excellent 
  261. features that the other lacks!
  262.  
  263. Quick C is good for base level debugging.  No good news with  its 
  264. editor though, except that its autoindent is just a little (and I 
  265. MEAN "little") better than Turbo (e.g. Home returns to  beginning 
  266. of text, not beginning of line).  Certainly support for the mouse 
  267. helps,  as  I  live and breath Windows/386 - being  able  to  get 
  268. C News 1-05                 Page 5                   06 Mar 1988
  269.      
  270. ================================================================
  271. Title: Integrated Environments. 
  272. ================================================================
  273.  
  274. around a large file of code is very snappy using the guide  bars.  
  275. It  is  also good for quickly compiling into  memory,  correcting 
  276. typos  and also for "lint-picking" code, even  providing  warning 
  277. errors  for ANSI compatibility at /W3.  Turbo C may be  a  little 
  278. better  in that regard, there having greater control  over  which 
  279. types of warnings are shown and which are not.
  280.  
  281. As  you may gather from the above, QC and TC are  very  different 
  282. products.   Both will produce reliable working code, and  provide 
  283. convenient  assistance to those learning the language,  but  each 
  284. approaches  it  in a different manner.  Quick C may  be  slightly 
  285. better for the beginner because of its non-involvement in  memory 
  286. models and the more esoteric parts of C programming.  Turbo C  is 
  287. an integrated environment for the more serious programmer.   Both 
  288. compilers  offer an excellent upgrade path to their command  line 
  289. versions  (and  QC a further upgrade to those serious  enough  to 
  290. want to afford the full MSC 5.x).
  291.  
  292. I  tend  to feel that QC has been released as a  development  and 
  293. learning  tool.   It certainly looks that way,  especially  after 
  294. compiling  a  non-trivial  program to 30K  binary,  then  running 
  295. EXEPACK on it to crunch it to 20K!  These results are  startling, 
  296. when  considering  that  the same file  compiled  under  MSC  5.0 
  297. produced an 18.5K executable (TC interactive environment wound up 
  298. a  little  over 15K).  I guess size isn't  everything,  but  that 
  299. certainly  indicated  that  there  were  lots  of  empty   spaces 
  300. produced.   Looks like EXEPACK is a handy utility for  those  who 
  301. use  the  stand-alone  QC package!  Very  little  was  gained  by 
  302. packing any of the other executables (few hundred bytes at best).  
  303. Turbo C, on the other hand, provides full compiler facilities  in 
  304. the environment itself.
  305.  
  306. A blow-by-blow comparison of features of each of these  compiler/ 
  307. environments  follows.   This  is not intended  to  be  a  "which 
  308. compiler  is best ..." but a basis on which to make  an  informed 
  309. decision,  whether MSC 5.0 compatibility is worth it, or  whether 
  310. Turbo C is enough for your purposes.
  311.  
  312. As  a  coding  tool, both compilers provide  similar  error  list 
  313. approaches,  with  the  ability  to easily  locate  the  line  in 
  314. question  which  resulted in the error.  Turbo  provides  a  more 
  315. intuitive error window which can be stepped through using Up  and 
  316. Down  arrow  keys, adjusting the current cursor position  in  the 
  317. source  file to that line.  Quick C has a more difficult  method, 
  318. and I had to dive into the manual to find it: Shift-F3 and Shift-
  319. F4 to next and previous errors.
  320.  
  321.  
  322. C News 1-05                 Page 6                   06 Mar 1988
  323.      
  324. ================================================================
  325. Title: Integrated Environments. 
  326. ================================================================
  327.  
  328. This example underlines the use of the keyboard generally;  Turbo 
  329. C having much more logical key assignments generally, with  Quick 
  330. C  relying far more upon the mouse interface - certainly a  mouse 
  331. provides   a  far  improved  interface  (MS-mouse  or   emulation 
  332. required).   Some  of  QC's key  combinations  are  difficult  to 
  333. fathom, requiring usually two simultaneous keystrokes.  The  most 
  334. often  used pop-up options are more easily accessed in  Turbo  C, 
  335. usually  by single keystroke (Alt-R to compile and run a  program 
  336. in memory), but less used options are placed in submenus and pop-
  337. up windows well out of harm's way.  Many of Quick C's most  often 
  338. used  functions  require  a  number  of  keystrokes  to   access, 
  339. including  compiling,  although  all  information  regarding  the 
  340. function is on a single screen.
  341.  
  342. TC  saves compile/setup these options in a configuration file  in 
  343. the current subdirectory, so different settings (taken  initially 
  344. from  a "master" in the main TC directory) can be maintained  for 
  345. each project.  Quick C similarly saves a QC.INI file.
  346.  
  347. Each  environment  provides  access to the  operating  system  by 
  348. offering "shell to DOS" options.  TC provides further options  to 
  349. list  and  change directories (under QC,  the  default  directory 
  350. remains  the startup directory, even if the directory is  changed 
  351. after shelling a second COMMAND.COM).  Files may be "picked"  and 
  352. edited using "point and shoot".  
  353.  
  354. Both compilers offer a program list arrangement where a number of 
  355. files  may  be pulled in and edited easily.   Certainly  Quick  C 
  356. offered  a more logical and thorough approach to this,  with  the 
  357. ability  to build a complete 'make' compatible makefile from  the 
  358. list contents.  Turbo's "pick list" is limited and used more  for 
  359. convenience rather than to edit/compile a logical group of files.  
  360. Turbo's  offering  of project files is less  intuitive  and  more 
  361. difficult to set up (at least to a seasoned MAKE user).  Quick  C 
  362. also  offers the ability to view/edit an include file by  placing 
  363. the  cursor  on an "#include" line and  selecting  View  Include.  
  364. This  not  only searches the current directory,  but  also  those 
  365. specified  in  the  INCLUDE environment  variable  (as  does  the 
  366. compiler).
  367.  
  368. The  convenience  Quick  C  offers  in  multi-file  compiles   is 
  369. comparable  to that of MAKE.  Certainly it is convenient that  it
  370. builds  a makefile (even though it uses an  interesting  'kludge' 
  371. for longer than 128-byte LINK lines), but of course limited  only 
  372. to  C  files.  Mixed language and assembly module  linking  still 
  373. requires editing, but the QC editor can be conveniently used  for 
  374. that.   Once this is done, however, MAKE must be used  externally 
  375. (after  unloading QC).  Still this approach can save much of  the 
  376. C News 1-05                 Page 7                   06 Mar 1988
  377.      
  378. ================================================================
  379. Title: Integrated Environments. 
  380. ================================================================
  381.  
  382. work  required to build and maintain a makefile even if  it  does 
  383. require   edits.   Making  the  file  transportable  to   another 
  384. directory  structure  is  easy by  standard  search  and  replace 
  385. functions.
  386.  
  387. Help  available in either compiler is excellent.  In addition  to 
  388. the standard "usage" help, Quick C also offers syntax and calling 
  389. convention   help  for  standard  library  functions,   providing 
  390. excellent support to the beginner (and not so-beginner).  This is 
  391. context  sensitive using Shift-F1 instead of F1 only, calling  up 
  392. the function on which the cursor is placed.
  393.  
  394. Code-level  debugging is where Quick C takes all the points.   It 
  395. includes  watchpoints,  breakpoints, dynamic  display  of  memory 
  396. variables  and conditional breakpoints.  This falls far short  of 
  397. the  full-blown  codeview (which, amongst other  things, provides 
  398. assembly  level debugging), but this is excellent for those  non-
  399. expert at ASM code anyway.  Step by step trace is supported, with 
  400. full  screen  swapping (to and from the  application  begin  run) 
  401. provided, which may be disabled if you wish to view only code and 
  402. variables.  This is a real time-saver in debugging and  available 
  403. right there in the environment, especially for variable tracing.
  404.  
  405. One  important  point  to  note,  however.   Turbo  C  gives  the 
  406. programmer  the (almost) full range of compile options  available 
  407. in  the command line version, TCC, including control over  memory 
  408. models.   Quick C (the environment) does not.  When compiling  to 
  409. memory,  medium  model MUST be used.  However, QCL  does  provide 
  410. this  option  similar  to  MSC 5.0's CL  (with  the  -A  switch).  
  411. Therefore,  where it is required that a different model be  used, 
  412. one must first develop the application in medium model,  generate 
  413. the appropriate makefile (which assumes QCL) then use the command 
  414. line version to compile the finished product.  This is not so bad 
  415. and  tends  to  encourage code which is  portable  across  memory 
  416. models (at least that's my experience).
  417.  
  418. I  hope this has given some insight into the workings and use  of 
  419. these  compilers.  They certainly give an excellent  introduction 
  420. to  the  language,  and while more  advanced  C  programmers  may 
  421. "outgrow"  the integrated environment, they are still  viable  as 
  422. tools  for  full time serious development.   Various  aspects  of 
  423. these  programs make them handy for doing things which  no  other 
  424. single  tool can do, bringing to the C community yet another  way 
  425. to  develop  code.   Let's  face it,  a  working  environment  is 
  426. important  to the amount of work done, and any improvement  is  a 
  427. blessing  and should improve productivity.  For the hobbyist,  it 
  428. makes C - the language - less difficult by providing on-line help 
  429. at  the touch of a key (something I've recently grown  accustomed 
  430. C News 1-05                 Page 8                   06 Mar 1988
  431.      
  432. ================================================================
  433. Title: Integrated Environments. 
  434. ================================================================
  435.  
  436. to), and certainly more pleasant to program in.
  437.  
  438. Like all tools, you can take it or leave it.  If you find that  a 
  439. good  editor  with  macro capability and  a  command-line  driven 
  440. compiler is best, then that will work better for you.
  441.  
  442. C News 1-05                 Page 9                   06 Mar 1988
  443.      
  444. ================================================================
  445. /Usr/Bin  by Marshall Presnell
  446. ================================================================
  447.  
  448.                                The /usr/bin
  449.                             Marshall Presnell
  450.  
  451.                       Talking with a FOSSIL - Part 1
  452.  
  453.        FOSSILs are NOT old bones. I've always wanted to say that! A
  454.        FOSSIL is really a standard communications interface for MS-
  455.        DOS and  PC-DOS computers. Many so-called "compatibles" that
  456.        run MS-DOS  and PC-DOS are not really compatible, especially
  457.        when it comes to communication. The communication facilities
  458.        are a  part of  the BIOS  system, and  that system  is not a
  459.        stringent requirement for the proper operation of MS-DOS. As
  460.        will happen,  the BIOS gets scrambled sometimes by different
  461.        manufacturers.
  462.  
  463.        IBM placed  its communication  interrupt at  vector 14  hex,
  464.        with a small number of functions available. This established
  465.        the "standard"  communications BIOS  entry point. Of course,
  466.        other issues  kept the  standard from being used on the wild
  467.        and varied  machines that  also ran  MS-DOS and  PC-DOS. The
  468.        concept of  a  FOSSIL  (which  stands  for  Fido/Opus/Seadog
  469.        Standard Interface  Layer) comes  from a few programmers who
  470.        wanted  a  real  standard  to  work  with  in  dealing  with
  471.        communications.  Naturally,  the  issue  expanded  to  video
  472.        services, timer  tick management, and application appendages
  473.        that would work across the wide variety of MS-DOS systems.
  474.  
  475.        FOSSILs can  be loaded  three ways (that I have figured out,
  476.        at least).  It can  be a  device driver,  as is  Ray Gwinn's
  477.        X00.SYS. It  can load as a TSR, like Bob Hartman's OpusComm.
  478.        And it  can be loaded to spawn a child process and field the
  479.        interrupts and  requests itself.  However it  is loaded, the
  480.        interface to  a FOSSIL  is  a  rigid  standard.  All  FOSSIL
  481.        entries are  done  through  INT  14  hex.  The  AH  register
  482.        contains  a  function  code,  and  other  registers  contain
  483.        function specific data.
  484.  
  485.        This  column   will  present  a  C  callable  library  which
  486.        interfaces with  a FOSSIL.  Using  this  library  will  help
  487.        ensure that any communications program that you write can be
  488.        easily ported to a foreign environment (so long as it runs a
  489.        FOSSIL!). Before  you continue  with this  article, it might
  490.        help if  you un-arced the file USR-BIN.ARC and read the file
  491.        called FOSSIL5.DOC.  It's a  long and  complex document, but
  492.        contains the  actual specification  for a  revision  5  (the
  493.        latest revision) FOSSIL driver.
  494.  
  495.  
  496. C News 1-05                 Page 10                  06 Mar 1988
  497.      
  498. ================================================================
  499. /Usr/Bin  by Marshall Presnell
  500. ================================================================
  501.  
  502.                         Coding the FOSSIL library
  503.  
  504.        For the  coding of  the FOSSIL  interface itself, I chose to
  505.        use assembly  language. Communications  are usually  a speed
  506.        bottleneck, so  this  decision  was  made  to  minimize  the
  507.        overhead of  coding it  in pure C. Since the FOSSIL standard
  508.        requires an  80x86 interrupt  system, this does not decrease
  509.        portability across our target systems (MS-DOS/PC-DOS).
  510.  
  511.        The assembly language files F_*.ASM are provided in the USR-
  512.        BIN archive  as well.  Use  the  Microsoft  Macro  Assembler
  513.        version 5  to compile this if you make any changes. (Look at
  514.        the MAKEFILE  to see  how MASM is called) You will also need
  515.        the MIXED.MAC file that is provided with that assembler. The
  516.        file FOSSIL.LIBJ  is also provided for those who do not have
  517.        the MASM  5 package. On furthur examination, you will find a
  518.        few C  files that  start with  "F_". These  contain  some  C
  519.        functions which  make  dealing  with  the  FOSSIL  interface
  520.        easier.
  521.  
  522.        All of  the low  level FOSSIL  functions are provided for in
  523.        the  F_*.ASM   files  and   the  FOSSIL.LIB  library.  These
  524.        functions are as follows:
  525.  
  526.        int f_setbaud(int  port,int rate_code)  - This function sets
  527.          the baud  rate of  the specified  port to a value which is
  528.          encoded in the rate_code variable. (The rate_code value is
  529.          NOT 300,  1200, 2400,  etc) The  port variable  is  0  for
  530.          COM1:,  1   for  COM2:,   etc.  This  convention  is  used
  531.          throughout the library wherever a port variable is used. A
  532.          status word is returned to the caller. (The status word is
  533.          defined in  the function  f_stat()). Instead of using this
  534.          function to set the baud rate, check the "helper" function
  535.          f_baud() in the F_BAUD.C file. It's very straightforward.
  536.  
  537.        void f_tx(int  port, int  character) - This function sends a
  538.          character to the specified port. If the transmit buffer is
  539.          full, this  function will  wait until the character can be
  540.          queued for  transmission. Only the lower byte of character
  541.          is signifigant. This function returns nothing.
  542.  
  543.        unsigned int  f_rx(int port)  - This  function will return a
  544.          character from  the specified  port. If the receive buffer
  545.          is empty,  this function  will wait  until a  character is
  546.          available before  returning. The  return value  is  mapped
  547.          into an  unsigned int.  The low byte is the returned ASCII
  548.          character.
  549.  
  550. C News 1-05                 Page 11                  06 Mar 1988
  551.      
  552. ================================================================
  553. /Usr/Bin  by Marshall Presnell
  554. ================================================================
  555.  
  556.        unsigned int f_stat(int port) - This function returns status
  557.          information regarding the specified port. The return value
  558.          is bit-mapped as follows:
  559.  
  560.             0x0100 - Received Data is available
  561.             0x0200 - Received data has overrun the buffer (ERROR)
  562.             0x2000 - Room is available in the transmit buffer
  563.             0x4000 - Transmit buffer is empty
  564.             0x8000 - Carrier Detected
  565.  
  566.          Manifest constants  have been  defined in  FOSSIL.H  which
  567.          correspond to these bit maps.
  568.  
  569.        int f_init(int port, int trigger, int * flag_address) - This
  570.          function initializes  the FOSSIL  for subsequent  function
  571.          requests on  a specified  port. In  other words, call this
  572.          function before  you  call  other  FOSSIL  functions!  The
  573.          trigger variable  (if set  to a non-zero value) causes the
  574.          initialization routine  to provide  a method  for checking
  575.          for control-c  activity. If  the trigger  byte is set, the
  576.          flag_address points  to an  integer in  the  application's
  577.          code which  is to  incremented when control-c is detected.
  578.          Note that  this control-c  business is an OPTIONAL service
  579.          for the  FOSSIL and  must only  be supported  on  machines
  580.          which can't  (or won't) issue an INT 1BH or INT 23H when a
  581.          control-c is  entered.  This  function  returns  a  "magic
  582.          number" of 0x1954 if the initialization was successful.
  583.  
  584.        void f_deinit(int  port) -  This function de-initializes the
  585.          specified port. Nothing is returned.
  586.  
  587.        void f_dtr(int port, int state) - This function controls the
  588.          state of  the DTR  (Data  Terminal  Ready)  line  for  the
  589.          specified port. Dropping DTR (state == 0) is a widely used
  590.          way of  terminating a  communications session. DTR must be
  591.          ON (state  == 1) if communications are to take place. This
  592.          function returns nothing.
  593.  
  594.        int f_ttint()  - This  function returns the interrupt number
  595.          for the timer tick hardware interrupt.
  596.  
  597.        int f_ttspeed()  - This  function  returns  the  approximate
  598.          number of ticks per second on the timer tick interrupt.
  599.  
  600.        int f_ttmilli()  - This  function  returns  the  approximate
  601.          number  of   milliseconds  per  tick  on  the  timer  tick
  602.          interrupt.
  603.  
  604. C News 1-05                 Page 12                  06 Mar 1988
  605.      
  606. ================================================================
  607. /Usr/Bin  by Marshall Presnell
  608. ================================================================
  609.  
  610.        void f_outflush(int port) - This function flushes (waits for
  611.          the all  data to  be  sent)  the  transmit  queue  to  the
  612.          communications line. This function can cause the FOSSIL to
  613.          go into  a tight  uninterruptable loop  if used  with flow
  614.          control active (see function f_flowctrl()).
  615.  
  616.        void  f_outpurge(int  port)  -  This  function  cancels  all
  617.          pending output for the specified port.
  618.  
  619.        void f_inpurge(int port) - This function cancels all pending
  620.          input which is in the receive queue but has not been read.
  621.  
  622.        int f_txnowait(int port, int character) - This function acts
  623.          identically to  f_tx() except  that if there is no room in
  624.          the transmit queue, the function returns a zero, otherwise
  625.          it returns a non-zero value.
  626.  
  627.        unsigned  int  f_peek(int  port)  -  This  performs  a  non-
  628.          destructive "look-ahead"  into the  receive buffer.  If  a
  629.          character is ready to be read from the receive queue, this
  630.          function returns  the  character  waiting,  otherwise,  it
  631.          returns 0xffff.
  632.  
  633.        unsigned int f_keyrdnowait() - This function returns the IBM
  634.          style scan  code is a character is available, otherwise it
  635.          returns 0xffff.
  636.  
  637.        unsigned int f_keyrd() - This function waits for a character
  638.          from the  keyboard if  necessary, then  it returns the IBM
  639.          style scan code of the key pressed.
  640.  
  641.        void f_flowctrl(int  port, int bitmask) - This function sets
  642.          the flow  control parameters  for the  specified port. The
  643.          bitmask is encoded as follows:
  644.  
  645.          0x0001 - Use XON/XOFF on transmitter
  646.          0x0002 - Use CTS/RTS (CTS on transmitter, RTS on receiver)
  647.          0x0008 - Use XON/XOFF on receiver
  648.  
  649.          Manifest constants  have been  defined in  FOSSIL.H  which
  650.          correspond to these bit maps.
  651.  
  652.        unsigned  int  f_ctrlcchk(int  port,  int  bitmask)  -  This
  653.          function does  two things  of interest.  The first  is  to
  654.          enable or  disable control-c  and control-k  checking. The
  655.          second is  to  enable  or  disable  the  transmitter.  The
  656.          following is the bitmask values:
  657.  
  658. C News 1-05                 Page 13                  06 Mar 1988
  659.      
  660. ================================================================
  661. /Usr/Bin  by Marshall Presnell
  662. ================================================================
  663.  
  664.          0x0001 - Enable / Disable Control-C/K checking
  665.          0x0002 - Enable / Disable the transmitter
  666.  
  667.          Manifest constants  have been  defined in  FOSSIL.H  which
  668.          correspond to these bit maps.
  669.  
  670.          If Control-C/K  checking is enabled, the return value from
  671.          this function  indicates if  a control-c  or control-k has
  672.          been received  since the  last call  to this function. The
  673.          transmitter  enable/disable   allows  the  application  to
  674.          control the transmitter in the same way that XON/XOFF flow
  675.          control does.
  676.  
  677.        void f_setcurs(int  row, int col) - This function provides a
  678.          standard method for setting the row and column position of
  679.          the cursor.  The upper left hand corner of the screen (the
  680.          home position) is row 0, column 0.
  681.  
  682.        unsigned int  f_getcurs() -  This returns the row and column
  683.          position of the current cursor position. The row is in the
  684.          upper byte of the return value, the column is in the lower
  685.          byte.
  686.  
  687.        void f_wransi(int  character) -  This function  provides the
  688.          fastest possible  display of  characters that  permit ANSI
  689.          processing to occur.
  690.  
  691.        void  f_watchdog(int   port,  int  state)  -  This  function
  692.          enables/disables the  "watchdog" monitor for the specified
  693.          port. If  the watchdog  is enabled and the carrier for the
  694.          specified port goes away, the system is booted.
  695.  
  696.        void f_wrbios(int  character)  -  This  function  sends  the
  697.          specified character  to the  screen using BIOS calls. Note
  698.          that this  function does  not use DOS calls at all because
  699.          it may  also be  used by  the  FOSSIL  driver  to  display
  700.          messages.
  701.  
  702.        unsigned int  f_insertfunc(void (*fptr)())  - This  function
  703.          inserts the  function pointed  to by  fptr into  the timer
  704.          tick interrupt chain. Note that the function inserted into
  705.          the chain  must be  compiled with  no stack traces enabled
  706.          (use the #pragma check_stack(off) in MSC 5). This function
  707.          returns a  zero value  if the function was inserted, and a
  708.          non-zero value if the insert failed for any reason.
  709.  
  710.        unsigned int  f_removefunc(void (*fptr)())  - This  function
  711.          removes the  function pointed  to by  fptr from  the timer
  712. C News 1-05                 Page 14                  06 Mar 1988
  713.      
  714. ================================================================
  715. /Usr/Bin  by Marshall Presnell
  716. ================================================================
  717.  
  718.          tick interrupt  chain. This  function returns a zero value
  719.          if the  function was  removed, and a non-zero value if the
  720.          remove failed for any reason.
  721.  
  722.        void f_reboot(int  temparature) - This function reboots your
  723.          system. If  temprature ==  0, a  cold boot  is  performed,
  724.          otherwise a  warm boot  is done.  If you get a return code
  725.          from THIS  function,  something  is  very  wrong  withyour
  726.          FOSSIL!
  727.  
  728.        int f_readblk(int  port, int  count, void  * buffer)  - This
  729.          function allows you to read a block of characters from the
  730.          receive buffer  to a  memory buffer  in your  application.
  731.          (Great for  file-transfer protocols!). The return value is
  732.          the number  of characters  actually transferred  from  the
  733.          FOSSIL buffer to your buffer.
  734.  
  735.        int f_writeblk(int  port, int  count, void  * buffer) - This
  736.          function allows  you to write a block of characters from a
  737.          memory buffer  in your application directly to the FOSSIL.
  738.          (Great for  file-transfer protocols!). The return value is
  739.          the number  of characters  actually transferred  from your
  740.          buffer to the FOSSIL buffer.
  741.  
  742.        void f_break(int port, int state) - This function starts and
  743.          stops a break signal. When state != 0, the break signal is
  744.          started, when state == 0, the break stops.
  745.  
  746.        void f_data(int  port, int  count, void  *  buffer)  -  This
  747.          function loads  a structure  (defined in  the  FOSSIL5.DOC
  748.          specification) which  contains information  of interest to
  749.          the  specific  implementation  of  FOSSIL  that  you  have
  750.          installed. See the FOSSIL5 document for more information.
  751.  
  752.        The f_installapi and f_removeapi functions are generally not
  753.          used by  high-level languages  and will  not be covered in
  754.          this issue.
  755.  
  756.        "But wait!",  you  say...  "Some  of  those  functions  have
  757.        NOTHING AT  ALL to  do with  communications!".   True. There
  758.        are functions  for keyboard input and video output and timer
  759.        tick management  as well. The main thing to remember is that
  760.        a FOSSIL lays over the top of the operating system, allowing
  761.        compatibility where it counts... at the application level.
  762.  
  763.        Next issue,  we'll see  how a  FOSSIL is  used in  an actual
  764.        application (a  dumb terminal  program). The capabilities in
  765.        using a  FOSSIL will astound and amaze you. Go ahead and try
  766. C News 1-05                 Page 15                  06 Mar 1988
  767.      
  768. ================================================================
  769. /Usr/Bin  by Marshall Presnell
  770. ================================================================
  771.  
  772.        some simple  stuff (or,  if  you  are  REALLY  daring,  some
  773.        complicated stuff!) with your compiler. FOSSIL.LIB is set up
  774.        as SMALL  model for  now. If  you have  any questions on the
  775.        assembly source  or FOSSILs  in general,  you can find me in
  776.        the C  conference on  FidoNet, or you can leave a message on
  777.        the RENEX BBS. Fido 109/639, telephone (703) 494-8331. C you
  778.        next issue!
  779.  
  780.  
  781.   C News 1-05                 Page 16                  06 Mar 1988
  782.      
  783. ================================================================
  784. ARTICLE SUBMISSION STANDARDS AND ADDRESSES
  785. ================================================================
  786.  
  787.      As I have repeatedly stated in this newsletter and previous
  788. issues, I would like to see user-submitted articles, reviews or
  789. questions.  Listed below are the standards that should be
  790. followed to make my job easier as an editor.
  791.  
  792.  
  793.      - Articles should be submitted in a ASCII non-formatted
  794.        file.  
  795.  
  796.      - If the article include code fragments as examples. Then
  797.        you can include the entire source file if you like for 
  798.        inclusion with the newsletter.
  799.  
  800.      - Book or magazine reviews should follow the same format,
  801.        that is outlined in this issue.  The publisher, author,
  802.        title, and ISBN number are a must.  
  803.  
  804.      - Compiler/and or product reviews, should include the
  805.        version number and manufacture.  If possible, reviews
  806.        should include a sample program with benchmarks.
  807.  
  808.     
  809.      If you have any questions you can contact me at the
  810. address's included on the next page.
  811.  
  812. C News 1-05                  Page 17                 03 Mar 1988
  813.  
  814. ================================================================
  815. ADDRESSES
  816. ================================================================
  817.  
  818. The C BBS is located at:
  819.  
  820.      C BBS
  821.      % BCL Limited
  822.      P.O. Box 9162
  823.      McLean VA, 22102
  824.  
  825.  
  826.      or you can send netmail to:
  827.  
  828.  
  829.      1:109/713  < The phone number in the current nodelist is
  830.                   inaccurate.  At this time it is not known
  831.                   when it will be corrected. >
  832.  
  833.  
  834.  
  835.  
  836.       C News 1-05                 Page 18                  06 Mar 1988
  837.      
  838. ================================================================
  839. USER RESPONSE FORM:
  840. ================================================================
  841.  
  842. This form will be included as a regular feature in all future
  843. issues of C NEWS.
  844.  
  845.  
  846.  
  847.  What did you think of the content of this Issue?  _____________
  848.      
  849.  _______________________________________________________________
  850.  
  851.  
  852.  What improvements can you think of that would make C News a
  853.  better tool for the C Community?
  854.  
  855.  _______________________________________________________________
  856.  
  857.  _______________________________________________________________
  858.  
  859.  
  860.  What is your favorite section or sections?  ___________________
  861.  
  862.  _______________________________________________________________
  863.  
  864.  
  865.  What don't you like about C News?  ____________________________
  866.  
  867.  _______________________________________________________________
  868.  
  869.  
  870.  Additional Comments:  _________________________________________
  871.  
  872.  _______________________________________________________________
  873.  
  874.  _______________________________________________________________
  875.  
  876.  _______________________________________________________________
  877.  
  878. C News 1-05                 Page 19                  06 Mar 1988
  879.      
  880. ================================================================
  881.                               INDEX
  882. ================================================================
  883.  
  884.  Subject:                                          Issue:
  885.  
  886.  Articles:
  887.  
  888.  Filename Wildcard Expansion in MSC                 4
  889.  Integrated Environment: TC & QC                    5
  890.  Talking with a Fossil                              5
  891.  TurboC and Interrupts: A few Questions             2
  892.  
  893.      
  894.  
  895.  Book Reviews:
  896.  
  897.  C Database Development                             1
  898.  C Programming Guide                                1
  899.  C Programming Language                             1
  900.  C Programmer's Guide to Serial Communications      3
  901.  C Programmer's Library                             1
  902.  C Primer Plus                                      1
  903.  C the Complete Reference                           2
  904.  Crafting C Tools for the IBM PC                    2
  905.  Learning to Program in C                           1
  906.  Microsoft C Programming on the IBM PC              1
  907.  MS-DOS Developer's Guide                           4
  908.  Programming in Windows                             3
  909.  Reliable Data Structures in C                      1
  910.  TurboC: Memory Resident Utilities                  5
  911.  TurboC Programmer's Reference Book                 2
  912.  
  913.  
  914.  Compilers: 
  915.  
  916.  QuickC                                             1 
  917.  
  918.      
  919.  Software Reviews: 
  920.   
  921.  Bplus11.arc                                        3
  922.  C_Dates.arc                                        4
  923.  Cdate.arc                                          4
  924.  Casm.arc                                           3
  925.  C-subr.arc                                         4
  926.  Docu.arc                                           3
  927.  Jcl-src.arc                                        4
  928.  Mscpopup.arc                                       3
  929.  Ndmake41.arc                                       4
  930.  Nuc-subr.arc                                       3
  931.  Shift_c.arc                                        4
  932. C News 1-05                 Page 20                  06 Mar 1988
  933.      
  934. ================================================================
  935.                               INDEX
  936. ================================================================
  937.  
  938.  Subject:                                          Issue:
  939.  
  940.  Software Reviews Cont:
  941.  
  942.  Sysact11.arc                                       4
  943.  Tp_to_qc.arc                                       3
  944.  Xenixarc.arc                                       4
  945.  
  946. C News 1-05                 Page 21                  06 Mar 1988
  947.      
  948. ================================================================
  949.                        DISTRIBUTION POINTS
  950. ================================================================
  951.  
  952.  
  953. Board Name               Number         Net/Node       Sysop
  954.  
  955. United States
  956.  
  957. C BBS               (703) 998-8377      1:109/713      Barry Lynch
  958. Alexandria, VA
  959.  
  960. Jaz C-Scape         (904) 724-1377      1:112/1027     Tom Evans
  961. Jacksonville, FL
  962.  
  963. Links.BBS           (916) 343-4422      1:119/13       Tom Baughman
  964. Chico, CA
  965.  
  966. Eastern C Board     Unknown             1:107/335      Todd Lehr
  967.  
  968. Rutgers1            (201) 932-4066      1:107/320      Michael Keyles
  969. Rutgers, NJ
  970.  
  971. PTC Net             (206) 757-4248      1:138/4        Arlen Fletcher
  972. Washington, State
  973.  
  974.  
  975. Canada
  976.  
  977. Another BBS System  (416) 465-7752      1:148/208      Mark Bowman
  978. Toronto, Canada
  979.  
  980. Europe
  981.  
  982. Eurpean Fido Gateway     Unknown        2:2/1          Henk Wevers
  983. The Netherlands
  984.  
  985. Australia
  986.  
  987. Alpha-Centuri BBS   011-61-3-874-3559    3:632/348   David Nugent
  988.  
  989.  
  990.  
  991.  
  992.      
  993.  
  994.  
  995. Another BBS System
  996.  
  997.